#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/* allocate space for type t */
#define new( t ) ((t *) malloc( sizeof( t ) ))

/* basic pair */
typedef struct pair	{
	struct pair *car;
	struct pair *cdr;
} Pair;

typedef Pair * (*PF)();  /* function pointer type */

/*
 * atoms
 *   An atom is a pair with the car set to one of the special symbols below.
 *   PROVISIONAL DESIGN: nil is special, and is represented by 0 = NULL
 */
#define SYMBOL ((Pair *) 1)
#define FIXNUM ((Pair *) 2)
#define FLOAT  ((Pair *) 3)
#define DOUBLE ((Pair *) 4)
#define PNAME  ((Pair *) 5)
#define VALUE  ((Pair *) 6)
#define FUNC   ((Pair *) 7)
#define LAMBDA ((Pair *) 8)
#define ATOM             9

#define is_fixnum( p ) (p->car == FIXNUM)
#define nval( p ) ((long) p->cdr)  /* extract the numeric value */

#define is_double( p ) (p->car == DOUBLE)
#define dval( p ) (*(double *) (p->cdr))

#define is_number( p ) (p->car == FIXNUM || p->car == DOUBLE)

#define is_symbol( p ) (p->car == SYMBOL)
#define is_func( p ) (p->car == FUNC)
#define is_lambda(p) (p->car==LAMBDA)
#define atom(p) (p==NULL||(int)p->car<ATOM)

#define CADR(p) (p->cdr->car)
#define CADDR(p) (p->cdr->cdr->car)

#include "init.h"
#include "reader.h"
#include "globals.h"
#include "printer.h"
#include "eval.h"
#include "prim.h"
#include "util.h"

